package cn.tedu.hospital.outpatient.controller;

import cn.tedu.hospital.base.response.JsonResult;
import cn.tedu.hospital.outpatient.pojo.dto.OutpatientDto;
import cn.tedu.hospital.outpatient.pojo.dto.OutpationQuery;
import cn.tedu.hospital.outpatient.pojo.entity.Outpatient;
import cn.tedu.hospital.outpatient.service.OutpatientService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@Api
@RestController
@RequestMapping("hospital/outpatient")
public class OutpatientController {

    @Autowired
    private OutpatientService outpatientService;

    @RequestMapping("save")
    public JsonResult saveOutpatient(OutpatientDto outpatientDto) {
        log.debug("开始处理【保存门诊预约】的请求，参数：{}", outpatientDto);
        outpatientService.saveOutpatient(outpatientDto);
        return JsonResult.ok();
    }

    @RequestMapping("select")
    public JsonResult selectOutpatient(OutpationQuery outpationQuery){
        log.debug("开始处理【查询门诊预约】的请求，参数：{}", outpationQuery);
        List<Outpatient> outpatients = outpatientService.selectOutpatient(outpationQuery);
        return JsonResult.ok(outpatients);
    }

}
